package com.huang.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@Slf4j
@Order(0)
@Component
@WebFilter(filterName= "filterMid" ,urlPatterns= "/*" )
public class FilterMid implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("FilterMid#doFilter...start");
        filterChain.doFilter(servletRequest, servletResponse);
        log.info("FilterMid#doFilter...end");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void destroy() {

    }
}
